package com.qiwx.pigeon.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.RadioGroup;

import androidx.annotation.Nullable;

import com.qiwx.pigeon.R;
import com.qiwx.pigeon.data.params.FertilizeParam;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @description
 * @Author qiwx
 * @Date 2020-05-23 10:23
 * 空窝选项
 **/
public class KWOptionView extends LinearLayout {
    @BindView(R.id.cb_jd)
    CheckBox cbJDEgg;
    @BindView(R.id.cb_empty)
    CheckBox cbEmpty;
    @BindView(R.id.group_xdrq_options)
    RadioGroup groupXdrqOptions;

    public KWOptionView(Context context) {
        this(context, null);
    }

    public KWOptionView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public KWOptionView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
        initEvent();
    }

    private void initView(Context context) {
        LayoutInflater mInflater = LayoutInflater.from(context);
        View view = mInflater.inflate(R.layout.group_lay_egg_layout, null);
        ButterKnife.bind(this, view);
        cbJDEgg.setVisibility(GONE);
        addView(view);

    }

    private void initEvent() {


    }

    public FertilizeParam getParam() {
        FertilizeParam param = new FertilizeParam();
//        param.setBadEgg(cbJDEgg.isChecked());
        param.setEmptyCage(cbEmpty.isChecked());
        param.setAmount(2);
        param.setFudan(false);
        param.setLay_egg_date(null);//后台来计算当前日期
        return param;
    }

    public void resetOptions() {
//        cbBadEgg.setChecked(false);
        cbEmpty.setChecked(false);
    }
}
